Skip to content

head gate: review run log tells a skipped branch name from odd fields, counts the listing (#651) - #657

Merged
scuttletoby merged 2 commits into
mainfrom
fix/651-head-gate-minors
Nov 20, 2026
Merged

scuttletoby merged 2 commits into
mainfrom
fix/651-head-gate-minors

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Part of #651 (the five minors from the two #650 reviews). The live check stays open in #651: it needs a project that has copied the review trigger and caller to its default branch, and none has yet.

The five minors

  1. Valid branch names got the misleading warning. Fixed in the check. The warning now fires only when the sha, repository or branch is missing or malformed. A branch with an ASCII control character counts as malformed, because git refuses those in a ref name. A branch git allows but the gate does not look up gets a plain line that says so: a no-break or zero-width space, an emoji joined by a zero-width joiner, a bidi override, or a name longer than 255. The branch name is not logged. These heads are still skipped, as before head gate: review trigger live check as a setup step, release note, warning on odd run fields (#379) #650; the fallback covers them.
  2. "No open pull request has the head" looked like a closed PR. The line now also says how many open pull requests GitHub listed on that branch, counting each number once. Setup step 8 now explains the difference. If nothing is listed for an open PR, the head=owner:branch filter is not GitHub's. If some are listed, the head sha or head repository differs. It stays a plain line: a review on a PR that closed meanwhile is normal, and a warning there would be noise.
  3. Docs mutant. The release-notes check now also needs "is refused" in the Upgrade, and a new check pins "(ci/v14 or before) is refused". Rewording it to "fails" is now killed.
  4. Upgrade wording was too strict. It now says "after the pin is at ci/v15 or later", and names the refused older pin as ci/v14 or before. One correction on the side: the head gate review trigger: #375 follow-ups (two PRs one branch, docs, caller if, test gap, live check) #379 sentence said "After ci/v19", but ci/v20 does not have the warning either (checked by git show ci/v20:…/head_gate.py). It now says "After ci/v20". Step 8 also says that an older pin logs the warning as a plain line (lens A's nit).
  5. "A real review run always has these fields" was too strong. The comment, the warning and the README now name the deleted fork (no head repository) as the one known harmless cause. Step 8 says to pick a PR whose branch name is plain and whose fork still exists. Neither case is tested against GitHub; the wording no longer depends on it.

Behaviour that did not change

Every return value, exit code, prs output and refusal is the same as before. Only log lines change. Nothing is judged that was skipped before, and nothing skipped that was judged. Long and non-printable branches still read nothing. The new log text is constant except for the count, so a run field cannot inject an annotation.

Tests (red first)

  • The new tests on origin/main's code and docs: head_gate.test.py gives 22 failing subtests across the three new or changed tests. fork-head-gate-workflow.test.py gives 4 failed checks.
  • On this branch: head_gate.test.py 108 OK, fork-head-gate-workflow.test.py all passed, fork-contracts.test.py all passed.
  • Mutants: 12 of 12 killed. Docs: "is refused" changed to "fails", the old pin wording put back, the step 8 filter wording changed. Code: the count never kept, the count not deduped, the plain branch line made a warning, control characters not treated as malformed, BRANCH_MAX dropped, isprintable dropped, the deleted-fork text dropped, "none with this head" dropped, and the plain-branch case falling through to the listing.
  • State question:
    • Runs again: this code path only reads, so a repeat logs the same line with the same count.
    • Stops half-way: each line is written before any post or after the one read. A failed listing is still refused, as before.
    • Old, empty or missing state: a run with no fields at all (None sha, repository and branch) is tested, and so are an empty listing and a listing with one number twice.
    • Old pins: they keep their old plain lines, and step 8 says so.

General vs project

All of this is general head-check gate code and docs, with no project facts. The live check is still project work: the first project that copies the trigger follows setup step 8 and records the result in #651.

🤖 Generated with Claude Code

scuttletoby and others added 2 commits November 20, 2026 17:06
…, counts the listing (#651)

- A head branch git allows but the gate does not look up (a no-break or
  zero-width space, an emoji joined by a zero-width joiner, longer than 255)
  now gets a plain line that says so, not the warning that blames GitHub's
  fields. The warning stays for missing or malformed sha, repository or
  branch (a branch with a control character git refuses), and names a
  deleted fork as the one known harmless cause.
- "no open pull request has the head" says how many open pull requests
  GitHub listed on that branch, so setup step 8 can tell a wrong filter
  (none listed) from a wrong head sha or repository (some listed).
- Release notes: the trigger's Upgrade needs a pin at ci/v15 or later (not
  "a release that has this entry"); the refused pin is ci/v14 or before; the
  #379 warning is after ci/v20 (that tag does not have it).
- The docs test checks "is refused" too.

Part of #651.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby
scuttletoby merged commit 57d0ffd into main Nov 20, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant